<template>
  <div>
    <div class="banner">
      <img  class="banner-img" :src="bannerImg" alt="">
      <div class="banner-title">{{sightName}}</div>
      <div class="banner-number" @click="handleGallaryToggle" >
        <span class="iconfont icon-pic banner-icon"></span>
        <span class="pic-num">{{gallaryImgs.length}}</span>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="gallaryImgs" v-show="showGallary" @close="handleGallaryToggle"></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/FadeAnimation'

export default {
  name: 'DetailBanner',
  props: {
    bannerImg: String,
    gallaryImgs: Array,
    sightName: String
  },
  data () {
    return {
      showGallary: false
    }
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  methods: {
    handleGallaryToggle () {
      this.showGallary = !this.showGallary
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner{
    position:relative;
    overflow:hidden;
    height: 0;
    padding-bottom:55%

    .banner-img{
      width:100%
    }
    .banner-title{
      position:absolute;
      left:0;
      right:0;
      bottom:0;
      padding: .1rem .2rem;
      min-height:.4rem;
      font-size:.36rem;
      color:#fff;
      background:linear-gradient(top,rgba(0,0,0,.2),rgba(0,0,0,.7));
    }
    .banner-number{
      position:absolute;
      left:.2rem;
      bottom:.66rem;
      padding: 0 .3rem;
      height:.4rem;
      line-height:.4rem;
      border-radius:.2rem;
      background:rgba(0,0,0,.5);
      font-size: .3rem;
      color:#fff;
      text-align:center;
      .icon-pic{
        font-size:  .24rem;
      }
    }
  }

</style>
